package net.kong.sns.rest.client.model;

import org.apache.commons.lang.builder.ToStringBuilder;

import java.util.Map;

/**
 * @author <a href="mailto:lanhuai@gmail.com">Ning Yubin</a>
 * @version $Id: Pay4TestRegOrderResponseImpl.java,v 1.1 2009/11/04 08:07:45 ningyubin Exp $
 */
public class Pay4TestRegOrderResponseImpl extends AbstractJsonAppObject implements Pay4TestRegOrderResponse {
    private String token;
    private String code;

    public Pay4TestRegOrderResponseImpl(String token, String code) {
        this.token = token;
        this.code = code;
    }

    public Pay4TestRegOrderResponseImpl() {

    }

    public String getToken() {
        return token;
    }

    public String getCode() {
        return code;
    }

    @Override
    protected void processJsonObject(Map<String, Object> stringObjectMap) {
        if (stringObjectMap != null) {
            this.token = (String) stringObjectMap.get(Field.TOKEN.toString());
            this.code = (String) stringObjectMap.get(Field.CODE.toString());
        }
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this).
                append("token", token).
                append("code", code).
                toString();
    }
}